/**
 * @file CommTask.c
 * @author SoBigDog (623644973lubin@163.com)
 * @brief 
 * @version 0.1
 * @date 2020-11-16
 * 
 * @copyright Copyright (c) 2020
 * 
 */
#include "CommTask.h"
#include "ShankConfig.h"

extern UART_HandleTypeDef huart1;
extern struct ShankConfig shank_config;

uint8_t rx_buff[100];

static void MX_USART1_UART_Init(void)
{
	huart1.Instance = USART1;
	huart1.Init.BaudRate = shank_config.uart_baudrate;
	huart1.Init.WordLength = UART_WORDLENGTH_8B;
	huart1.Init.StopBits = UART_STOPBITS_1;
	huart1.Init.Parity = UART_PARITY_NONE;
	huart1.Init.Mode = UART_MODE_TX_RX;
	huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
	huart1.Init.OverSampling = UART_OVERSAMPLING_16;
	if (HAL_UART_Init(&huart1) != HAL_OK) {
		Error_Handler();
	}
}

static void TaskInit(void) 
{
	MX_USART1_UART_Init();
}

void CommTask(void const * arg)
{
	TaskInit();

	while (1) {
		osDelay(100);
		HAL_UART_Transmit_DMA(&huart1, "1234567890", 10);
	}
}
